package day06;

import java.util.Arrays;

public class Homework1_2 {
    public static void main(String[] args) {
        int[] array =new int[20];
        for(int i=0;i<array.length;i++){
            array[i]=(int)(Math.random()*100);
            System.out.print(array[i]+"\t");
        }
        System.out.println(" ");
        int max=array[0];
        for(int i=1;i<array.length;i++) {
            if (array[i] > max) {
                max = array[i];

            }
        }
            System.out.println("最大值为："+max);
         array= Arrays.copyOf(array,array.length+1);
         array[array.length-1]=max;
         for(int i=0;i<array.length;i++){
             System.out.print(array[i]+"\t");
         }


    }
}
